home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / dev / obero / Interfaces3_4.lha / Interfaces / HardBlocks.mod < prev    next >
Text File  |  1994-03-05  |  10KB  |  227 lines

  1. (*
  2. (*
  3. **  Amiga Oberon Interface Module:
  4. **  $VER: HardBlocks.mod 40.15 (28.12.93) Oberon 3.0
  5. **
  6. **   © 1993 by Fridtjof Siebert
  7. *)
  8. *)
  9.  
  10. MODULE HardBlocks;
  11.  
  12. IMPORT e   * := Exec,
  13.        sys * := SYSTEM;
  14.  
  15. (*--------------------------------------------------------------------
  16.  *
  17.  *      This file describes blocks of data that exist on a hard disk
  18.  *      to describe that disk.  They are not generically accessable to
  19.  *      the user as they do not appear on any DOS drive.  The blocks
  20.  *      are tagged with a unique identifier, checksummed, and linked
  21.  *      together.  The root of these blocks is the RigidDiskBlock.
  22.  *
  23.  *      The RigidDiskBlock must exist on the disk within the first
  24.  *      RDB_LOCATION_LIMIT blocks.  This inhibits the use of the zero
  25.  *      cylinder in an AmigaDOS partition: although it is strictly
  26.  *      possible to store the RigidDiskBlock data in the reserved
  27.  *      area of a partition, this practice is discouraged since the
  28.  *      reserved blocks of a partition are overwritten by "Format",
  29.  *      "Install", "DiskCopy", etc.  The recommended disk layout,
  30.  *      then, is to use the first cylinder(s) to store all the drive
  31.  *      data specified by these blocks: i.e. partition descriptions,
  32.  *      file system load images, drive bad block maps, spare blocks,
  33.  *      etc.
  34.  *
  35.  *      Though only 512 byte blocks are currently supported by the
  36.  *      file system, this proposal tries to be forward-looking by
  37.  *      making the block size explicit, and by using only the first
  38.  *      256 bytes for all blocks but the LoadSeg data.
  39.  *
  40.  *------------------------------------------------------------------*)
  41.  
  42. TYPE
  43.  
  44. (*
  45.  *  NOTE
  46.  *      optional block addresses below contain -1 to indicate
  47.  *      a NULL address, as zero is a valid address
  48.  *)
  49.  
  50.   RigidDiskBlockPtr * = UNTRACED POINTER TO RigidDiskBlock;
  51.   RigidDiskBlock * = STRUCT
  52.     id * : LONGINT;             (* 4 character identifier *)
  53.     summedLongs * : LONGINT;    (* size of this checksummed structure *)
  54.     chkSum * : LONGINT;         (* block checksum (longword sum to zero) *)
  55.     hostID * : LONGINT;         (* SCSI Target ID of host *)
  56.     blockBytes * : LONGINT;     (* size of disk blocks *)
  57.     flags * : LONGSET;          (* see below for defines *)
  58.   (* block list heads *)
  59.     badBlockList * : LONGINT;   (* optional bad block list *)
  60.     partitionList * : LONGINT;  (* optional first partition block *)
  61.     fileSysHeaderList * : LONGINT; (* optional file system header block *)
  62.     driveInit * : LONGINT;      (* optional drive-specific init code *)
  63.                         (* DriveInit(lun,rdb,ior): "C" stk & d0/a0/a1 *)
  64.     reserved1 * : ARRAY 6 OF LONGINT;   (* set to -1 *)
  65.   (* physical drive characteristics *)
  66.     cylinders * : LONGINT;      (* number of drive cylinders *)
  67.     sectors * : LONGINT;        (* sectors per track *)
  68.     heads * : LONGINT;          (* number of drive heads *)
  69.     interleave * : LONGINT;     (* interleave *)
  70.     park * : LONGINT;           (* landing zone cylinder *)
  71.     reserved2 * : ARRAY 3 OF LONGINT;
  72.     writePreComp * : LONGINT;   (* starting cylinder: write precompensation *)
  73.     reducedWrite * : LONGINT;   (* starting cylinder: reduced write current *)
  74.     stepRate * : LONGINT;       (* drive step rate *)
  75.     reserved3 * : ARRAY 5 OF LONGINT;
  76.   (* logical drive characteristics *)
  77.     rdbBlocksLo * : LONGINT;    (* low block of range reserved for hardblocks *)
  78.     rdbBlocksHi * : LONGINT;    (* high block of range for these hardblocks *)
  79.     loCylinder * : LONGINT;     (* low cylinder of partitionable disk area *)
  80.     hiCylinder * : LONGINT;     (* high cylinder of partitionable data area *)
  81.     cylBlocks * : LONGINT;      (* number of blocks available per cylinder *)
  82.     autoParkSeconds * : LONGINT; (* zero for no auto park *)
  83.     reserved4 * : ARRAY 2 OF LONGINT;
  84.   (* drive identification *)
  85.     diskVendor * : ARRAY 8 OF CHAR;
  86.     diskProduct * : ARRAY 16 OF CHAR;
  87.     diskRevision * : ARRAY 4 OF CHAR;
  88.     controllerVendor * : ARRAY 8 OF CHAR;
  89.     controllerProduct * : ARRAY 16 OF CHAR;
  90.     controllerRevision * : ARRAY 4 OF CHAR;
  91.     reserved5 * : ARRAY 10 OF LONGINT;
  92.   END;
  93.  
  94. CONST
  95.  
  96.   idNameRigidDisk * = sys.VAL(LONGINT,"RDSK");
  97.  
  98.   locationLimit * = 16;
  99.  
  100.   last       * = 0;       (* no disks exist to be configured after *)
  101.                           (*   this one on this controller *)
  102.   lastLun    * = 1;       (* no LUNs exist to be configured greater *)
  103.                           (*   than this one at this SCSI Target ID *)
  104.   lsatTID    * = 2;       (* no Target IDs exist to be configured *)
  105.                           (*   greater than this one on this SCSI bus *)
  106.   noReselect * = 3;       (* don't bother trying to perform reselection *)
  107.                           (*   when talking to this drive *)
  108.   diskID     * = 4;       (* rdb_Disk... identification valid *)
  109.   ctrlrID    * = 5;       (* rdb_Controller... identification valid *)
  110.  
  111. TYPE
  112.  
  113. (*------------------------------------------------------------------*)
  114.   BadBlockEntryPtr * = UNTRACED POINTER TO BadBlockEntry;
  115.   BadBlockEntry * = STRUCT
  116.     badBlock * : LONGINT;       (* block number of bad block *)
  117.     goodBlock * : LONGINT;      (* block number of replacement block *)
  118.   END;
  119.  
  120.   BadBlockBlockPtr * = UNTRACED POINTER TO BadBlockBlock;
  121.   BadBlockBlock * = STRUCT
  122.     id * : LONGINT;             (* 4 character identifier *)
  123.     summedLongs * : LONGINT;    (* size of this checksummed structure *)
  124.     chkSum * : LONGINT;         (* block checksum (longword sum to zero) *)
  125.     hostID * : LONGINT;         (* SCSI Target ID of host *)
  126.     next * : LONGINT;           (* block number of the next BadBlockBlock *)
  127.     reserved * : LONGINT;
  128.     blockPairs * : ARRAY 61 OF BadBlockEntry; (* bad block entry pairs *)
  129.     (* note [61] assumes 512 byte blocks *)
  130.   END;
  131.  
  132. CONST
  133.  
  134.   idNameBadBlock * = sys.VAL(LONGINT,"BADB");
  135.  
  136. TYPE
  137.  
  138. (*------------------------------------------------------------------*)
  139.  
  140.   PartitionBlockPtr * = UNTRACED POINTER TO PartitionBlock;
  141.   PartitionBlock * = STRUCT
  142.     id * : LONGINT;                      (* 4 character identifier *)
  143.     summedLongs * : LONGINT;             (* size of this checksummed structure *)
  144.     chkSum * : LONGINT;                  (* block checksum (longword sum to zero) *)
  145.     hostID * : LONGINT;                  (* SCSI Target ID of host *)
  146.     next * : LONGINT;                    (* block number of the next PartitionBlock *)
  147.     flags * : LONGSET;                   (* see below for defines *)
  148.     reserved1 * : ARRAY 2 OF LONGINT;
  149.     devFlags * : LONGINT;                (* preferred flags for OpenDevice *)
  150.     driveName * : ARRAY 32 OF CHAR;      (* preferred DOS device name: BSTR form *)
  151.                                          (* (not used if this name is in use) *)
  152.     reserved2 * : ARRAY 15 OF LONGINT;   (* filler to 32 longwords *)
  153.     environment * : ARRAY 17 OF LONGINT; (* environment vector for this partition *)
  154.     eReserved * : ARRAY 15 OF LONGINT;   (* reserved for future environment vector *)
  155.   END;
  156.  
  157. CONST
  158.  
  159.   idNamePartition * = sys.VAL(LONGINT,"PART");
  160.  
  161.   bootable  * = 0;      (* this partition is intended to be bootable *)
  162.                         (*   (expected directories and files exist) *)
  163.   noMount   * = 1;      (* do not mount this partition (e.g. manually *)
  164.                         (*   mounted, but space reserved here) *)
  165.  
  166. TYPE
  167.  
  168. (*------------------------------------------------------------------*)
  169.  
  170.   FileSysHeaderBlockPtr * = UNTRACED POINTER TO FileSysHeaderBlock;
  171.   FileSysHeaderBlock * = STRUCT
  172.     id * : LONGINT;                     (* 4 character identifier *)
  173.     summedLongs * : LONGINT;            (* size of this checksummed structure *)
  174.     chkSum * : LONGINT;                (* block checksum (longword sum to zero) *)
  175.     hostID * : LONGINT;                 (* SCSI Target ID of host *)
  176.     next * : LONGINT;                   (* block number of next FileSysHeaderBlock *)
  177.     flags * : LONGSET;                  (* see below for defines *)
  178.     reserved1 * : ARRAY 2 OF LONGINT;
  179.     dosType * : LONGINT;                (* file system description: match this with *)
  180.                                         (* partition environment's DE_DOSTYPE entry *)
  181.     version * : LONGINT;                (* release version of this code *)
  182.     patchFlags * : LONGSET;             (* bits set for those of the following that *)
  183.                                         (*   need to be substituted into a standard *)
  184.                                         (*   device node for this file system: e.g. *)
  185.                                         (*   0x180 to substitute SegList & GlobalVec *)
  186.     type * : LONGINT;                   (* device node type: zero *)
  187.     task * : LONGINT;                   (* standard dos "task" field: zero *)
  188.     lock * : LONGINT;                   (* not used for devices: zero *)
  189.     handler * : LONGINT;                (* filename to loadseg: zero placeholder *)
  190.     stackSize * : LONGINT;              (* stacksize to use when starting task *)
  191.     priority * : LONGINT;               (* task priority when starting task *)
  192.     startup * : LONGINT;                (* startup msg: zero placeholder *)
  193.     segListBlocks * : LONGINT;          (* first of linked list of LoadSegBlocks: *)
  194.                                         (*   note that this entry requires some *)
  195.                                         (*   processing before substitution *)
  196.     globalVec * : LONGINT;              (* BCPL global vector when starting task *)
  197.     reserved2 * : ARRAY 23 OF LONGINT;  (* (those reserved by PatchFlags) *)
  198.     reserved3 * : ARRAY 21 OF LONGINT;
  199.   END;
  200.  
  201. CONST
  202.  
  203.   idNameFileSysHeader * = sys.VAL(LONGINT,"FSHD");
  204.  
  205. TYPE
  206.  
  207. (*------------------------------------------------------------------*)
  208.  
  209.   LoadSegBlockPtr * = UNTRACED POINTER TO LoadSegBlock;
  210.   LoadSegBlock * = STRUCT
  211.     id * : LONGINT;                     (* 4 character identifier *)
  212.     summedLongs * : LONGINT;            (* size of this checksummed structure *)
  213.     chkSum * : LONGINT;                 (* block checksum (longword sum to zero) *)
  214.     hostID * : LONGINT;                 (* SCSI Target ID of host *)
  215.     next * : LONGINT;                   (* block number of the next LoadSegBlock *)
  216.     loadData * : ARRAY 123 OF LONGINT;  (* data for "loadseg" *)
  217.     (* note [123] assumes 512 byte blocks *)
  218.   END;
  219.  
  220. CONST
  221.  
  222.   idNameLoadSeg * = sys.VAL(LONGINT,'LSEG');
  223.  
  224. END HardBlocks.
  225.  
  226.  
  227.